package ru.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.reflect.MethodSignature;

@Aspect
public class MySimpleLoggerAspect {

    @Before("execution(* *(..))")
    public void beforeCallMethod(JoinPoint joinPoint) {
        String className = ((MethodSignature)joinPoint.getSignature()).getMethod().getDeclaringClass().getSimpleName();
        String classMethod = ((MethodSignature)joinPoint.getSignature()).getMethod().getName();
        System.out.println("[MySimpleLoggerAspect.java] " + className + " - " + classMethod);
    }
}
